<?php

namespace app\company\controller;

use app\company\model\OrderTest;
use app\service\ExcelExport;
use think\facade\Log;
use think\Response;

class Order extends Base
{
    public function exportOrder(): Response
    {
        $param = $this->request->param();
        Log::record($param);
        if($param){
            \app\company\model\Order::create(['data'=>json_decode($param, true)]);
            return $this->success('获取成功',[]);
        }else{
            return $this->error('获取失败');
        }
//        $order = OrderTest::find(1);
//        // json转数组
//        $order = json_decode($order->data, true);
//        foreach ($order['data'] as $item){
//        }
//        $excelExport = new ExcelExport();
//        $excelExport->setCellValue('A1', 'Hello World !');
//        $excelExport->setCellValue('B1', 'Another Cell');
//        // 继续设置其他单元格的值...
//
//        $excelExport->export('hello_world.xlsx');
    }
}